package com.yx.shop.web.controller.demo;

import com.yx.shop.common.Const;
import com.yx.shop.web.controller.BaseServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Classname ${NAME}
 * @Description TODO:
 * @Date 2021/05/06 10:13
 * @Created by yx
 */
@WebServlet(name = "EmpController", value = "/emp")
public class EmpController extends BaseServlet {

    public void login(HttpServletRequest request, HttpServletResponse response) throws IOException {
        System.out.println("login====>" + this);
        //包含二进制文件,验证码,故不应交由父类处理(会导致验证码获取失败)
        response.sendRedirect("/login.jsp");
    }

    public String index2(HttpServletRequest request, HttpServletResponse response) {
        System.out.println("index2====>" + this);
//        response.sendRedirect("/index.jsp");
        //将转发,重定向,响应json等操作交由父类处理,约定规范以识别
        return Const.REDIRECT+"/index.jsp";
    }
}
